/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cube.charts.cubedesign;

import java.awt.Graphics;

/**
 *
 * @author admin
 */
public class Grid implements Designable{
    private Graphics g;
    private double p[][];
    private int x=1;
    private int y=2;
    private int z=3;
    

    public void paint(){
        // Lokale Würfel-Koordinaten
        // in Welt-Koordinaten: +200
        g.drawLine((int)(p[1][x])+200,(int)(p[1][y])+200,
                         (int)(p[2][x])+200,(int)(p[2][y])+200);
        g.drawLine((int)(p[2][x])+200,(int)(p[2][y])+200,
                         (int)(p[3][x])+200,(int)(p[3][y])+200);
        g.drawLine((int)(p[3][x])+200,(int)(p[3][y])+200,
                         (int)(p[4][x])+200,(int)(p[4][y])+200);
        g.drawLine((int)(p[4][x])+200,(int)(p[4][y])+200,
                         (int)(p[1][x])+200,(int)(p[1][y])+200);
        g.drawLine((int)(p[5][x])+200,(int)(p[5][y])+200,
                         (int)(p[6][x])+200,(int)(p[6][y])+200);
        g.drawLine((int)(p[6][x])+200,(int)(p[6][y])+200,
                         (int)(p[7][x])+200,(int)(p[7][y])+200);
        g.drawLine((int)(p[7][x])+200,(int)(p[7][y])+200,
                         (int)(p[8][x])+200,(int)(p[8][y])+200);
        g.drawLine((int)(p[8][x])+200,(int)(p[8][y])+200,
                         (int)(p[5][x])+200,(int)(p[5][y])+200);
        g.drawLine((int)(p[1][x])+200,(int)(p[1][y])+200,
                         (int)(p[5][x])+200,(int)(p[5][y])+200);
        g.drawLine((int)(p[2][x])+200,(int)(p[2][y])+200,
                         (int)(p[6][x])+200,(int)(p[6][y])+200);
        g.drawLine((int)(p[3][x])+200,(int)(p[3][y])+200,
                         (int)(p[7][x])+200,(int)(p[7][y])+200);
        g.drawLine((int)(p[4][x])+200,(int)(p[4][y])+200,
                         (int)(p[8][x])+200,(int)(p[8][y])+200);
    }

    public void setG(Graphics g) {
        this.g = g;
    }

    public void setP(double[][] p) {
        this.p = p;
    }
    
}
